package com.jdk8.parameter_03;

import java.util.ArrayList;
import java.util.List;

public class AppleModel {

    public List<Apple> filterApples(String color, AppleStrategy appleStrategy, List<Apple> apples) {
        ArrayList<Apple> appleLists = new ArrayList<>();
        for (Apple apple : apples) {
            if (appleStrategy.Strategy(color, apple)) {
                appleLists.add(apple);
            }
        }
        return appleLists;
    }

    public ArrayList<String> prettyPrintApple(List<Apple> apples, AppleFormatter appleFormatter){
        ArrayList<String> strings = new ArrayList<>();
        for(Apple apple: apples){
            String str = appleFormatter.accept(apple);
            strings.add(str);
        }
        return strings;
    }
}
